package com.ruoyi.common.enums;

import cn.hutool.core.util.StrUtil;

/**
 * 通道状态
 *
 * @author ruoyi
 */
public enum ChannelEnum {
    //自动回调
    FACE("10000", "当面付"),
    H5("10002", "手机网站"),

    //手动回调
    UID("10001", "支付宝UID"),
    // BANK("10003", "银行卡转账"),
    ZFB("10004", "支付宝转账"),
    TB("10005", "淘宝/咸鱼"),
    //ZFB_XHB("10006", "支付宝小荷包"),
    SZ_RMB("10007", "数字人民币"),

    ZFB_ZZ("10008", "转账码"),

    //手动回调
    //手动回调
    SM_UID("10009", "小额UID"),
    ;

    private final String code;
    private final String name;

    ChannelEnum(String code, String info) {
        this.code = code;
        this.name = info;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelEnum getChannelEnum(String code) {
        for (ChannelEnum item : ChannelEnum.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }

    public static String getName(String code) {
        for (ChannelEnum item : ChannelEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return StrUtil.EMPTY;
    }

    public static String getCode(String name) {
        for (ChannelEnum item : ChannelEnum.values()) {
            if (StrUtil.equals(item.getName(), name)) {
                return item.getCode();
            }
        }
        return StrUtil.EMPTY;
    }
}
